<template>
  <div>
    <van-nav-bar
      :title="
        comment.reply_count > 0 ? comment.reply_count + '条回复' : '暂无数据'
      "
    >
      <van-icon @click="close" slot="left" name="cross" />
    </van-nav-bar>

    <comment-item :comment="comment"></comment-item>
    <hr />
    <comment-list
      type="c"
      :list="list2"
      :source="comment.com_id"
    ></comment-list>

    <hr />
    <!-- 写评论回复 -->
    <div style="position:fixed;bottom:0;width:100%">
      <van-button
        @click="showPost = true"
        slot="title"
        round
        block
        type="info"
        size="small"
        native-type="submit"
      >
        评论回复
      </van-button>
    </div>

    <!-- 发表评论回复 -->
    <van-popup v-model="showPost" position="bottom">
      <comment-post
        @postshow="postshow"
        :target="comment.com_id"
      ></comment-post>
    </van-popup>
  </div>
</template>

<script>
import commentPost from "./comment-post";
import commentItem from "./comment-item";
import commentList from "./comment-list";
export default {
  name: "",
  data() {
    return {
      list2: [],
      showPost: false
    };
  },
  props: {
    comment: {}
  },
  components: {
    commentItem,
    commentList,
    commentPost
  },
  created() {
    console.log(this.comment, 77666);
  },
  methods: {
    postshow(obj) {
      //  关闭弹出层
      this.showPost = false;
      this.list2.unshift(obj);
    },

    //  关闭对话框
    close(){
       this.$emit('postshow22')
    }
  }
};
</script>
<style lang="less" scoped></style>
